package com.iot.ht.controller.htuserlogin;

import com.iot.core.annotation.Auth;
import com.iot.core.annotation.Log;
import com.iot.core.data.BaseQto;
import com.iot.core.data.entity.HtUserLogin;
import com.iot.core.enums.AuthType;
import com.iot.ht.controller.htuserlogin.data.HtUserLoginDebugDto;
import com.iot.ht.controller.htuserlogin.data.HtUserLoginQto;
import com.iot.ht.controller.htuserlogin.service.IHtUserLoginService;
import com.mybatisflex.core.paginate.Page;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/htuserlogin")
@Tag(name = "在线用户", description = "")
public class HtUserLoginController {
    @Autowired
    IHtUserLoginService ihtUserLoginService;


    @Auth(authType = AuthType.Login)
    @Log(logNeed = false,logTemplete ="",logPin = true,logPout = true)
    @PostMapping("/page")
    @Operation(summary = "在线用户分页", description = "")
    public Page<HtUserLogin> page(@RequestBody HtUserLoginQto mm){

        return ihtUserLoginService.page(mm);
    }

    @Auth(authType = AuthType.Auth)
    @Log(logNeed = true,logTemplete ="",logPin = true,logPout = true)
    @PostMapping("/forcelx")
    @Operation(summary = "强制离线", description = "")
    public  int forceLx(@RequestBody BaseQto mm){

        return ihtUserLoginService.forceLx(mm);
    }


    @Auth(authType = AuthType.Auth)
    @Log(logNeed = true,logTemplete ="",logPin = true,logPout = true)
    @PostMapping("/setdebug")
    @Operation(summary = "设置调试模式", description = "")
    public  int setDebug(@RequestBody HtUserLoginDebugDto mm){

        return ihtUserLoginService.setDebug(mm);
    }





}
